<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
String outNumDeathRateInfoJson= (String)request.getAttribute("outNumDeathRateInfoJson");
String success= (String)request.getAttribute("success");
%>
<link rel="stylesheet" href="${basePath}/assets/bootstrap/css/bootstrap.css"/>    
<link rel="stylesheet" href="${basePath}/assets/css/medical_record/home_page.css"/>
<link rel="stylesheet" href="${basePath}/assets/css/basic.css"/>
<link rel="stylesheet" href="${basePath}/assets/jquery-ui/jquery-ui.css"/>


<script type="text/javascript" src="${basePath}/assets/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/assets/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${basePath}/assets/jquery-ui/jquery-ui.js"></script>
<script type="text/javascript" src="${basePath}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${basePath}assets/js/echarts.js"></script>
<script type="text/javascript" src="${basePath}/assets/My97DatePicker/WdatePicker.js"></script>
<input type="hidden" id="basePath" value="${basePath }">
<form action="${basePath}/report/editOutNumsAndDeathRateForm"
	method="post" id="outDeathRateForm">
<input type="hidden" id="month" name="month" value="${month}">
<table style="width:100%;" cellpadding="0" cellspacing="0" id="table">
<tbody>
	   <tr>
		
		  <td colspan="6" style="text-align:right;">
		      <input type="button" value="保存" class="btn"  onclick="saveOutDeathRate()">
		      
		      
		       <input type="button" value="导出" class="btn"  onclick="exportOutDeathRate()">
		      
		  </td>
	   </tr>
			
			<tr>
			   <td class="tdLabel_7" style="width:10%">出院人数及死亡率</td>
				
			
				<td class="tdLabel_8" colspan="7">
					<textarea style="width:95%;height:120px" name="note">${outNumDeathRateInfo.outNumDeathRateText}</textarea>
				</td>
			</tr>
			
		    <tr>
			   <td class="tdLabel_7" style="width:10%">说明</td>
				<td class="tdLabel_8" colspan="7">
					<textarea style="width:95%;height:120px" id="note">${outNumDeathRateInfo.outNumDeathRateNote}</textarea>
				</td>
			</tr>
			
			 <tr>
				 <td class="tdLabel_7">
				 	图2  ${year}年${month}月出院人数及死亡率
				 </td>
				<td class="tdLabel_8" colspan="5" style="height:400px;">
						<div id="container" style="height: 400px;width:100%"></div>
					
				</td>
			 </tr>
			
	
			
		</tbody>
</table>
	

</form>





<script>
    var  myChart;
    
    

	function exportOutDeathRate(){
	   var month = $("#month").val();
       var base64info = myChart.getDataURL();
       $.ajax({
          type:"post",
          data:{image:base64info,method:'getImage'},
          url:"${basePath}/report/exportOutDeathRate",
          success:function(data){
               window.location.href ="${basePath}/report/exportOutDeathRate?method=export&month="+month;
          }
       })
	}


     //保存
     function saveOutDeathRate(){
     
         var note = $("#note").val();
	     var base64info = myChart.getDataURL();
		   $.ajax({
		       type:"post",
		       data:{note:note,image:base64info},
		       url:"${basePath}/report/saveOutDeathRate",
		       success:function(data){
		    	   layer.alert(data.msg,{icon:1});
		       }
		   })

     }
     
     //初始化图表信息
     $(function(){
		var outNumDeathRateInfoJson= <%=outNumDeathRateInfoJson%>;
		if(null!=outNumDeathRateInfoJson){
		   initCharSet(outNumDeathRateInfoJson);
		}
		
     });
     
    
     //charset图表
     function initCharSet(params){
      var dom = document.getElementById("container");
      myChart = echarts.init(dom);
var app = {};
option = null;
app.title = '折柱混合';

option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'cross',
            crossStyle: {
                color: '#999'
            }
        }
    },
  
    legend: {
        data:['出院人次','死亡率'],
        y: 'bottom'
    },
    xAxis: [
        {
            type: 'category',
            data: params.monthList,
            axisPointer: {
                type: 'shadow'
            }
        }
    ],
    yAxis: [
        {
            type: 'value',
            name: '出院人次',
           /*  min: 0,
            max: 20000,
            interval: 2000, */
            axisLabel: {
                formatter: '{value}'
            }
        },
        {
            type: 'value',
            name: '死亡率%',
           /*  min: 0.1,
            max: 1,
            interval: 0.1, */
            axisLabel: {
                formatter: '{value}'
            }
        }
    ],
    series: [
        
        {
            name:'出院人次',
            type:'bar',
             barWidth:90,
            data:params.outNumList
        },
        {
            name:'死亡率',
            type:'line',
            yAxisIndex: 1,
            data:params.deathRateList
        }
    ]
};
;
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
     }
     
     


 

	
</script>